package com.hptpd.questionnairesurvey.controller.wx;

import com.hptpd.questionnairesurvey.component.Result;
import com.hptpd.questionnairesurvey.controller.base.BaseController;
import com.hptpd.questionnairesurvey.service.IUserService;
import com.hptpd.questionnairesurvey.vo.AddSurveyVo;
import com.hptpd.questionnairesurvey.vo.UserVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * \* Created with IntelliJ IDEA.
 * \* Date: 2019/10/29
 * \*
 * \* Description:
 * \
 *
 * @author walter_long
 */
@RestController
@RequestMapping("/api/wx")
public class WxUserController extends BaseController {
    @Resource(name = "iUserService")
    private IUserService iUserService;

    /**
     * 微信小程序用户登录
     * @param userVo UserVo
     * @return Result
     */
    @RequestMapping(value = "/user/login", method = RequestMethod.POST)
    public Result wxLogin(
            @RequestBody UserVo userVo){
        return iUserService.wxLogin(userVo);
    }

    /**
     * 微信小程序用户注册
     * @param userVo UserVo
     * @return Result
     */
    @RequestMapping(value = "/user/register", method = RequestMethod.POST)
    public Result wxRegister(
            @RequestBody UserVo userVo){
        return iUserService.wxRegister(userVo);
    }

    /**
     * 微信小程序用户注册
     * @param phone String
     * @return Result
     */
    @RequestMapping(value = "/phone/validate", method = RequestMethod.GET)
    public Result sendMsgValidateCode(
            @RequestParam String phone){
        return iUserService.sendMsgValidateCode(phone);
    }
}
